package us.mooresr.geartrack.client.events;

import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.EventHandler;
import us.mooresr.geartrack.shared.model.Item;
import com.google.gwt.event.shared.HasHandlers;

public class ItemCheckedInEvent extends
		GwtEvent<ItemCheckedInEvent.ItemCheckedInHandler> {

	public static Type<ItemCheckedInHandler> TYPE = new Type<ItemCheckedInHandler>();
	private Item item;

	public interface ItemCheckedInHandler extends EventHandler {
		void onItemCheckedIn(ItemCheckedInEvent event);
	}

	public ItemCheckedInEvent(Item item) {
		this.item = item;
	}

	public Item getItem() {
		return item;
	}

	@Override
	protected void dispatch(ItemCheckedInHandler handler) {
		handler.onItemCheckedIn(this);
	}

	@Override
	public Type<ItemCheckedInHandler> getAssociatedType() {
		return TYPE;
	}

	public static Type<ItemCheckedInHandler> getType() {
		return TYPE;
	}

	public static void fire(HasHandlers source, Item item) {
		source.fireEvent(new ItemCheckedInEvent(item));
	}
}
